var ClubGroup_Hequnrizhi_Item = Item.extend({
    _ccsFileName: res.ClubGroup_Hequnrizhi_Item_json,
    initItem: function () {
    },
    refreshData: function (data) {
        var filterCmd = ['AddClubGroup', 'addLog'];
        var clubId = data.club_id;
        var time = data.create_time;
        var clubOwnerId = ClubDataManager.getClubOwnerUid(clubId);
        var clubOwnerName = ClubDataManager.getClubOwnerName(clubId);
        data =  data['data'];
        var cmd = data['cmd'];
        var cmd1 =  data['opInfo'];
        var cmd2 = '';
        var cmd3 = '';
        if(cmd1){
            cmd2 =  data['opInfo']['op'];
            cmd3 =  cmd2 == 0 ? 'bangding':'jiechu';
        }
        var strCmd = cmd == 'addLog' ? cmd3 : cmd;
        var name1 ='';
        var name2 ='';
        var name3 ='';
        var uid1 ='';
        var uid2 ='';
        var uid3 ='';
        if(strCmd == 'bangding'){
            name1 = clubOwnerName;
            uid1 = clubOwnerId;
            name2 = data['opedName'];
            uid2 = data['opedUid'];
            name3 = data['opInfo']['opName'];
            uid3 = data['opInfo']['opUid'];

        }else  if(strCmd == 'AddClubGroup') {
            name1 = clubOwnerName;
            uid1 = clubOwnerId;
            name2 = data['name'];
            uid2 = data['op_uid'];
        }else  if(strCmd == 'jiechu') {
            name1 = data['opedName'];
            uid1 = data['opedUid'];
            name2 = data['opInfo']['opName'];
            uid2 = data['opInfo']['opUid'];
        }
        var mergeData =  this._nodeList['mergeData'] ;
        var strList = [];
        if(data){
            strList = this.splitClubString(strCmd,name1,uid1,name2,uid2,name3,uid3);
        }

        var richText = mergeData.getChildByName('richText');
        if(richText){
            richText.removeFromParent(true);
        }
        if(!mergeData.getChildByName('richText')){
            var colorArr = [cc.color('#207c00'),cc.color('#507EB1'),cc.color('#d95b0e'),cc.color('#507EB1'),cc.color('#d95b0e')];
            richText = new ccui.RichText();
            richText.setAnchorPoint(cc.p(0,1));
            richText.setName('richText');
            richText.ignoreContentAdaptWithSize(false);
            richText.setContentSize(cc.size(960,100));
            if(!cc.sys.isNative){
                richText.setPosition(cc.p(15-richText.getContentSize().width/2,112+richText.getContentSize().height/2));
            }else {
                richText.setPosition(cc.p(15,112));
            }
            mergeData.addChild(richText);
            if(strList && strList.length){
                for(var i = 0 ; i < strList.length ; i++){
                    var re1 = new ccui.RichElementText(i+1, colorArr[i], 255, strList[i], 'Helvetica', 24);
                    richText.pushBackElement(re1);
                }
            }
        }




        this._nodeList['mergeData']['txt_date'].setString(time) ;




    },
    splitClubString:function (cmd,optorName,optorUid,optorName1,optorUid1,optorName2,optorUid2) {
        var strList = [];
        var str1 = '['+optorName+' ID:'+optorUid+']';
        var str2 = '['+optorName1+' ID:'+optorUid1+']';
        var str3 ='';
        var optName1 ='';
        var optName2 ='';
        if(optorName2&&optorUid2){
            str3= '['+optorName2+' ID:'+optorUid2+']';
        }
        switch (cmd){
            case 'AddClubGroup':
                optName1 = '和';
                optName2 = '成立合作群';
                break;
            case 'bangding':
                optName1 = '将';
                optName2 = '分配给';
                break;
            case 'jiechu':
                optName1 = '和';
                optName2 = '解除绑定';
                break;
        }
        strList.push(str1);
        strList.push(optName1);
        strList.push(str2);
        strList.push(optName2);
        if(str3){
            strList.push(str3);
        }
        return  strList;
    },
});